﻿namespace Beaker.Common.Specs.Builders.Instance
{
	public sealed class MaybeBuilder<T>
		// cannot use builder baseclass, because that in turn uses the thing we trying to test
	{
		private T _value;
		private bool _hasValueSet;

		public MaybeBuilder<T> WrappingValue(T value)
		{
			_value = value;
			_hasValueSet = true;
			return this;
		}

		public Maybe<T> Build()
		{
			if (!_hasValueSet)
				return new Maybe<T>();

			return new Maybe<T>(_value);
		}
	}
}